﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace App.Validate
{
    public class StringLengthValidatorElementAttribute : ValidatorElementAttribute
    {
        public int LowerBound { get;  set; }
        public int UpperBound { get;  set; }

        public StringLengthValidatorElementAttribute(string name)
            : base(name)
        {
            this.LowerBound = int.MinValue;
            this.UpperBound = int.MaxValue;
        }

        public StringLengthValidatorElementAttribute(string messageTemplate, int lowerBound)
            : base(messageTemplate)
        {
            this.LowerBound = lowerBound;
            this.UpperBound = int.MaxValue;
        }

        public override Validator CreateValidator()
        {
            return new StringLengthValidator(string.Empty, this.LowerBound, this.UpperBound);
        }
    }
}
